<script language="javascript">
	function check_login(){
		var username = $("merchant_username").value;
		var password = $("merchant_password").value;
		if(username.blank()){
			$("username_message").update ("请输入用户名");
			return false;
		}else if(password.length == 0){
			$("password_message").update ("请输入密码");
			return false;
		}
		
		return true;
	}
	
	function check_username(){
		var username = $("merchant_username").value;
		if(username.blank()){
			$("username_message").update ("请输入用户名");
		}else{
			$("username_message").update ("");
		}
	}
</script>

<div class="login_form_wrapper">
	<div class="login_form_title">
		<div class="login_form_title_wrapper"><img src="/images/form_title.png"/> 登录</div>
	</div>
	<div class="error_info"><span class="error_info_text"><%= flash[:notice]%></span></div>
	<% form_for :merchant, :url => {:action => "try_login"} do |form|%>
	<div id="login_form_content">
		<table width="100%" border="0" cellpadding="0" cellspacing="1">
			<tr>
				<td class="form_td_left"><span class="form_td_left_name">用户名<span></td>
				<td class="form_td_right"><span class="form_td_right_element"><%= form.text_field :username, :size => 20, :onchange => "check_username();" %><span id="username_message"></span><span></td>
			</tr>
			<tr>
				<td class="form_td_left"><span class="form_td_left_name">密&nbsp;码<span></td>
				<td class="form_td_right"><span class="form_td_right_element"><%= form.password_field :password, :size =>20 %><span id="password_message"></span><span></td>
			</tr>
		</table>
	</div>
	<div id="login_form_button_area">
		<div class="login_form_button_wrapper">
			<%= submit_tag("登录", :id => 'commit', :onclick => "return check_login();", :class => "login_form_button") %> 
			<input class="login_form_button" type="button" name="submit" value="注    册"/>
		</div>
	</div>
	<% end %>
</div>